This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
RE: How to get 7 values out of more than 2'000'000 documents ~Umberto Nongeroson 1.Dec.03 08:37 PM a Web browser Applications Development 6.0.2 CF2Windows 2000
Searching through millions of documents takes time no matter how you do it. If you create a view on the fly, it's going to take a long time to construct the initial index, because even if the selection formula will result in just 6 documents, the server must still examine each document to see whether it meets the selection criteria.
The most efficient way is to keep a permanent view sorted by user -- then you can use GetAllDocumentsByKey to pull in a collection of all the user's documents at once -- or even use @DbLookup to retrieve the result you're asking for with a single line of macro code. It takes a while to create the view index initially, but it's comparatively quick -- and fully automatic -- to update the index with any changed documents since the last time the view was used.
A reflection about this design: from the little you've said, it sounds like your application is overly relational in structure. Your application would operate far more efficiently if you had one document for each user, which listed all their categories in a multivalue field. You can still create categorized or sorted views that sort users by category, etc. if you do this.
A full-text index is also reasonably efficient to use, but not as precise as a view key search.